home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / imake / RCS / Imake.rules,v < prev    next >
Encoding:
Text File  |  1991-10-22  |  44.3 KB  |  1,525 lines

  1. head     1.1;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @@;
  7.  
  8.  
  9. 1.1
  10. date     91.10.22.13.47.25;  author rab;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @@
  17.  
  18.  
  19.  
  20. 1.1
  21. log
  22. @Initial revision
  23. @
  24. text
  25. @XCOMM -------------------------------------------------------------------------
  26. XCOMM Imake rules for building libraries, programs, scripts, and data files
  27. XCOMM rules:  $XConsortium: Imake.rules,v 1.123 91/09/16 20:12:16 rws Exp $
  28.  
  29. /*
  30.  *           MACHINE-INDEPENDENT RULES; DO NOT MODIFY
  31.  *
  32.  * Warning, when defining rules: make sure you do not include both a trailing
  33.  * backslash and double ampersand backslash or else you will get an extra
  34.  * backslash in the Makefile.
  35.  * 
  36.  * The following macros are defined for the various templates and Imakefiles
  37.  * (for a list of the applicable make variables, see the template files):
  38.  * 
  39.  * SaberProgramTarget        (program,srclist,objlist,locallibs,syslibs)
  40.  * RemoveTargetProgram        (program)
  41.  * MakeDir            (dir)
  42.  * BuildIncludes        (srclist,dstsubdir,dstupdir)
  43.  * NormalProgramTarget        (program,objects,deplibs,locallibs,syslibs)
  44.  * SetUIDProgramTarget        (program,objects,deplibs,locallibs,syslibs)
  45.  * SingleProgramTarget        (program,objects,locallibs,syslibs)
  46.  * SimpleProgramTarget        (program)
  47.  * ComplexProgramTarget        (program)
  48.  * ComplexProgramTarget_1    (program,locallib,syslib)
  49.  * ComplexProgramTarget_2    (program,locallib,syslib)
  50.  * ComplexProgramTarget_3    (program,locallib,syslib)
  51.  * ServerTarget            (server,subdirs,objects,libs,syslibs)
  52.  * RanLibrary            (args)
  53.  * InstallLibrary        (libname,dest)
  54.  * MergeIntoInstalledLibrary    (tolib,fromlib)
  55.  * InstallLibraryAlias        (libname,alias,dest)
  56.  * InstallLintLibrary        (libname,dest)
  57.  * InstallManPageLong        (file,destdir,dest)
  58.  * InstallManPage        (file,destdir)
  59.  * InstallManPageAliases    (file,destdir,aliases)
  60.  * InstallNamedNonExec        (srcname,dstname,dest)
  61.  * InstallNonExecFile        (file,dest)
  62.  * InstallNonExec        (file,dest)
  63.  * InstallProgramWithFlags    (program,dest,flags)
  64.  * InstallProgram        (program,dest)
  65.  * InstallScript        (program,dest)
  66.  * InstallNamedProg        (srcname,dstname,dest)
  67.  * LinkFileList            (step,list,dir,sub)
  68.  * InstallMultipleDestFlags    (step,list,dest,flags)
  69.  * InstallMultipleDest        (step,list,dest)
  70.  * InstallMultiple        (list,dest)
  71.  * InstallMultipleFlags        (list,dest,flags)
  72.  * InstallMultipleMan        (list,dest)
  73.  * InstallAppDefaults        (class)
  74.  * InstallAppDefaultsLong    (file,class)
  75.  * DependDependency        ()
  76.  * DependTarget            ()
  77.  * DependTarget3        (srcs1,srcs2,srcs3)
  78.  * CleanTarget            ()
  79.  * TagsTarget            ()
  80.  * ImakeDependency        (target)
  81.  * BuildMakefileTarget        (notused,imakeflags)
  82.  * MakefileTarget        ()
  83.  * LibMkdir            (dir)
  84.  * LibCleanDir            (dir)
  85.  * ObjectCompile        (options)
  86.  * NormalLibObjCompile        (options)
  87.  * NormalSharedLibObjCompile    (options)
  88.  * LibObjCompile        (dir,options)
  89.  * DebuggedLibObjCompile    (options)
  90.  * ProfiledLibObjCompile    (options)
  91.  * SharedLibObjCompile        (options)
  92.  * NormalLibraryObjectRule    ()
  93.  * NormalFortranObjectRule    ()
  94.  * ObjectFromSpecialSource    (dst,src,flags)
  95.  * SpecialObjectRule        (objs,depends,options)
  96.  * NormalLibraryTarget        (libname,objlist)
  97.  * NormalLibraryTarget2        (libname,objlist1,objlist2)
  98.  * NormalLibraryTarget3        (libname,objlist1,objlist2,objlist3)
  99.  * NormalDepLibraryTarget    (libname,deplist,objlist)
  100.  * SubdirLibraryRule        (objlist)
  101.  * ProfiledLibraryTarget    (libname,objlist)
  102.  * DebuggedLibraryTarget    (libname,objlist)
  103.  * AliasedLibraryTarget        (libname,alias)
  104.  * NormalRelocatableTarget    (objname,objlist)
  105.  * ProfiledRelocatableTarget    (objname,objlist)
  106.  * DebuggedRelocatableTarget    (objname,objlist)
  107.  * LintLibraryTarget        (libname,srclist)
  108.  * NormalLintTarget        (srclist)
  109.  * LintTarget            ()
  110.  * LinkSourceFile        (src,dir)
  111.  * LinkFile            (tofile,fromfile)
  112.  * MakeSubincludesForBuild    (step,dir,srclist)
  113.  * NamedTargetSubdirs        (name,dirs,verb,flags,subname)
  114.  * NamedMakeSubdirs        (name,dirs)
  115.  * MakeSubdirs            (dirs)
  116.  * DependSubdirs        (dirs)
  117.  * ForceSubdirs            (dirs)
  118.  * InstallSubdirs        (dirs)
  119.  * InstallManSubdirs        (dirs)
  120.  * IncludesSubdirs        (dirs)
  121.  * NamedCleanSubdirs        (name,dirs)
  122.  * CleanSubdirs            (dirs)
  123.  * NamedTagSubdirs        (name,dirs)
  124.  * TagSubdirs            (dirs)
  125.  * MakeLintSubdirs        (dirs,target,subtarget)
  126.  * LintSubdirs            (dirs)
  127.  * MakeLintLibSubdirs        (dirs)
  128.  * MakeMakeSubdirs        (dirs,target)
  129.  * MakeNsubdirMakefiles        ()
  130.  * MakefileSubdirs        (dirs)
  131.  * CppScriptTarget        (dst,src,defs,deplist)
  132.  * MakeScriptFromCpp        (name,defs)
  133.  * CppFileTarget        (dst,src,defs,deplist)
  134.  * MakeDirectories        (step,dirs)
  135.  * MakeFontsDir            (deplist)
  136.  * MakeFonts            ()
  137.  * InstallFontObjs        (objs,dest)
  138.  * InstallFonts            (dest)
  139.  * InstallFontAliases        (dest)
  140.  * FontSrc            (basename)
  141.  * FontBaseObj            (basename)
  142.  * InstallFontScale        (dest)
  143.  * UncompressedFontTarget    (basename)
  144.  * UncompressedFontTarget    (basename)
  145.  * CompressedFontTarget        (basename)
  146.  * FontTarget            (basename)
  147.  * FontObj            (basename)
  148.  * AllTarget            (depends)
  149.  *
  150.  *
  151.  * The following are in Imake.tmpl:
  152.  *
  153.  * Concat            (a,b)
  154.  * Concat3            (a,b,c)
  155.  * 
  156.  *
  157.  * The following are in specific <os>Lib.rules:
  158.  *
  159.  * SharedLibraryTarget        (libname,rev,solist,down,up)
  160.  * SharedLibraryDataTarget    (libname,rev,salist)
  161.  * InstallSharedLibrary        (libname,rev,dest)
  162.  * InstallSharedLibraryData    (libname,rev,dest)
  163.  * 
  164.  */
  165.  
  166. #define NullParameter
  167.  
  168. /* if [ -d ] or [ ! -d ] causes make to fail, define this as - */
  169. #ifndef DirFailPrefix
  170. #define DirFailPrefix
  171. #endif
  172.  
  173. /*
  174.  * SaberProgramTarget - generate rules to make Saber-C read in sources and
  175.  * objects.
  176.  */
  177. #ifndef SaberProgramTarget
  178. #if HasSaberC
  179. #define SaberProgramTarget(program,srclist,objlist,locallibs,syslibs)    @@@@\
  180. Concat(saber_,program):: srclist                    @@@@\
  181.     XCOMM load $(ALLDEFINES) srclist locallibs $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) syslibs @@@@\
  182.                                     @@@@\
  183. Concat(osaber_,program):: objlist                    @@@@\
  184.     XCOMM load $(ALLDEFINES) objlist locallibs $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) syslibs
  185.  
  186. #else
  187. #define SaberProgramTarget(program,srclist,objlist,locallibs,syslibs) /**/
  188. #endif
  189. #endif
  190.  
  191. #ifndef RemoveTargetProgram
  192. #if RemoveTargetProgramByMoving
  193. #define RemoveTargetProgram(program) \
  194. if [ -f program ]; then $(RM) Concat(program,~); $(MV) program Concat(program,~); fi
  195. #else
  196. #define RemoveTargetProgram(program) $(RM) program
  197. #endif
  198. #endif
  199.  
  200. #ifndef MakeDir
  201. #define MakeDir(dir) DirFailPrefix@@if [ -d dir ]; then set +x; \    @@@@\
  202.         else (set -x; $(MKDIRHIER) dir); fi
  203. #endif
  204.  
  205. #ifndef BuildIncludes
  206. #define BuildIncludes(srclist,dstsubdir,dstupdir)            @@@@\
  207. includes::                                @@@@\
  208.     MakeDir($(BUILDINCDIR)/dstsubdir)                @@@@\
  209.     @@(set -x; cd $(BUILDINCDIR)/dstsubdir; for i in srclist; do \    @@@@\
  210.         $(RM) $$i; \                        @@@@\
  211.         $(LN) $(BUILDINCTOP)/dstupdir/$(CURRENT_DIR)/$$i .; \    @@@@\
  212.     done)
  213. #endif /* BuildIncludes */
  214.  
  215. /*
  216.  * NormalProgramTarget - generate rules to compile and link the indicated 
  217.  * program; since it does not use any default object files, it may be used for
  218.  * multiple programs in the same Imakefile.
  219.  */
  220. #ifndef NormalProgramTarget
  221. #define    NormalProgramTarget(program,objects,deplibs,locallibs,syslibs)    @@@@\
  222. program: objects deplibs                        @@@@\
  223.     RemoveTargetProgram($@@)                        @@@@\
  224.     $(CC) -o $@@ objects $(LDOPTIONS) locallibs $(LDLIBS) syslibs $(EXTRA_LOAD_FLAGS) @@@@\
  225.                                     @@@@\
  226. clean::                                    @@@@\
  227.     $(RM) program
  228. #endif /* NormalProgramTarget */
  229.  
  230.  
  231. #ifndef SetUIDProgramTarget
  232. #define SetUIDProgramTarget NormalProgramTarget
  233. #endif
  234.  
  235.  
  236. /*
  237.  * SingleProgramTarget - obsolete version of NormalProgramTarget that does
  238.  * not have deplibs.
  239.  */
  240. #ifndef SingleProgramTarget
  241. #define    SingleProgramTarget(program,objects,locallibs,syslibs)        @@@@\
  242. NormalProgramTarget(program,objects,NullParameter,locallibs,syslibs)
  243. #endif /* SingleProgramTarget */
  244.  
  245. /*
  246.  * SimpleProgramTarget - generate rules for compiling and linking programs
  247.  * that only have one C source file.  It should only be used in Imakefiles 
  248.  * that describe a single program.
  249.  */
  250. #ifndef SimpleProgramTarget
  251. #define    SimpleProgramTarget(program)                    @@@@\
  252.            OBJS = program.o                        @@@@\
  253.            SRCS = program.c                        @@@@\
  254.                                     @@@@\
  255. ComplexProgramTarget(program)
  256. #endif /* SimpleProgramTarget */
  257.  
  258.  
  259.  
  260. /*
  261.  * ComplexProgramTarget - generate rules for compiling and linking the 
  262.  * program specified by $(OBJS) and $(SRCS), installing the program and its
  263.  * man page, and generating dependencies.  It should only be used in 
  264.  * Imakefiles that describe a single program.
  265.  */
  266. #ifndef ComplexProgramTarget
  267. #define    ComplexProgramTarget(program)                    @@@@\
  268.         PROGRAM = program                        @@@@\
  269.                                     @@@@\
  270. AllTarget(program)                            @@@@\
  271.                                     @@@@\
  272. program: $(OBJS) $(DEPLIBS)                        @@@@\
  273.     RemoveTargetProgram($@@)                        @@@@\
  274.     $(CC) -o $@@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) @@@@\
  275.                                     @@@@\
  276. SaberProgramTarget(program,$(SRCS),$(OBJS),$(LOCAL_LIBRARIES),NullParameter) @@@@\
  277.                                     @@@@\
  278. InstallProgram(program,$(BINDIR))                    @@@@\
  279. InstallManPage(program,$(MANDIR))                    @@@@\
  280. DependTarget()                                @@@@\
  281. LintTarget()                                @@@@\
  282.                                     @@@@\
  283. clean::                                    @@@@\
  284.     $(RM) $(PROGRAM)
  285. #endif /* ComplexProgramTarget */
  286.  
  287.  
  288. /*
  289.  * ComplexProgramTarget_1 - generate rules for compiling and linking the
  290.  * program specified by $(OBJS1) and $(SRCS1), installing the program and its
  291.  * man page, and generating dependencies for it and any programs described
  292.  * by $(SRCS2) and $(SRCS3).  It should be used to build the primary 
  293.  * program in Imakefiles that describe multiple programs.
  294.  */
  295. #ifndef ComplexProgramTarget_1
  296. #define    ComplexProgramTarget_1(program,locallib,syslib)            @@@@\
  297.             OBJS = $(OBJS1) $(OBJS2) $(OBJS3)                @@@@\
  298.             SRCS = $(SRCS1) $(SRCS2) $(SRCS3)                @@@@\
  299.                                     @@@@\
  300. AllTarget($(PROGRAMS))                            @@@@\
  301.                                     @@@@\
  302. program: $(OBJS1) $(DEPLIBS1)                        @@@@\
  303.     RemoveTargetProgram($@@)                        @@@@\
  304.     $(CC) -o $@@ $(LDOPTIONS) $(OBJS1) locallib $(LDLIBS) syslib $(EXTRA_LOAD_FLAGS) @@@@\
  305.                                     @@@@\
  306. InstallProgram(program,$(BINDIR))                    @@@@\
  307. InstallManPage(program,$(MANDIR))                    @@@@\
  308.                                     @@@@\
  309. SaberProgramTarget(program,$(SRCS1),$(OBJS1),locallib,syslib)        @@@@\
  310.                                     @@@@\
  311. DependTarget()                                @@@@\
  312. LintTarget()                                @@@@\
  313.                                     @@@@\
  314. clean::                                    @@@@\
  315.     $(RM) $(PROGRAMS)
  316. #endif /* ComplexProgramTarget_1 */
  317.  
  318.  
  319. /*
  320.  * ComplexProgramTarget_2 - generate rules for compiling and linking the
  321.  * program specified by $(OBJS2) and $(SRCS2) and installing the program and
  322.  * man page.  It should be used to build the second program in Imakefiles 
  323.  * describing more than one program.
  324.  */
  325. #ifndef ComplexProgramTarget_2
  326. #define    ComplexProgramTarget_2(program,locallib,syslib)            @@@@\
  327. program: $(OBJS2) $(DEPLIBS2)                        @@@@\
  328.     RemoveTargetProgram($@@)                        @@@@\
  329.     $(CC) -o $@@ $(LDOPTIONS) $(OBJS2) locallib $(LDLIBS) syslib $(EXTRA_LOAD_FLAGS) @@@@\
  330.                                     @@@@\
  331. SaberProgramTarget(program,$(SRCS2),$(OBJS2),locallib,syslib)        @@@@\
  332.                                     @@@@\
  333. InstallProgram(program,$(BINDIR))                    @@@@\
  334. InstallManPage(program,$(MANDIR))
  335. #endif /* ComplexProgramTarget_2 */
  336.  
  337.  
  338. /*
  339.  * ComplexProgramTarget_3 - generate rules for compiling and linking the
  340.  * program specified by $(OBJS3) and $(SRCS3) and installing the program and
  341.  * man page.  It should be used to build the third program in Imakefiles 
  342.  * describing more than one program.
  343.  */
  344. #ifndef ComplexProgramTarget_3
  345. #define    ComplexProgramTarget_3(program,locallib,syslib)            @@@@\
  346. program: $(OBJS3) $(DEPLIBS3)                        @@@@\
  347.     RemoveTargetProgram($@@)                        @@@@\
  348.     $(CC) -o $@@ $(LDOPTIONS) $(OBJS3) locallib $(LDLIBS) syslib $(EXTRA_LOAD_FLAGS) @@@@\
  349.                                     @@@@\
  350. SaberProgramTarget(program,$(SRCS3),$(OBJS3),locallib,syslib)        @@@@\
  351.                                     @@@@\
  352. InstallProgram(program,$(BINDIR))                    @@@@\
  353. InstallManPage(program,$(MANDIR))
  354. #endif /* ComplexProgramTarget_3 */
  355.  
  356.  
  357.  
  358. /*
  359.  * ServerTarget - generate rules to compile, link, and relink an X server.
  360.  */
  361. #ifndef ServerTarget
  362. #define    ServerTarget(server,subdirs,objects,libs,syslibs)        @@@@\
  363. server: subdirs objects libs                        @@@@\
  364.     -@@if [ -f server ]; then set -x; \                @@@@\
  365.         $(MV) server server.bak; else exit 0; fi        @@@@\
  366.     $(CC) $(CDEBUGFLAGS) $(CCOPTIONS) -o server objects libs $(EXTRA_LIBRARIES) syslibs $(EXTRA_LOAD_FLAGS) @@@@\
  367.                                     @@@@\
  368. Concat(load,server):                            @@@@\
  369.     -@@if [ -f server ]; then set -x; \                @@@@\
  370.         $(MV) server server.bak; else exit 0; fi        @@@@\
  371.     $(CC) $(CDEBUGFLAGS) $(CCOPTIONS) -o server objects libs $(EXTRA_LIBRARIES) syslibs $(EXTRA_LOAD_FLAGS)
  372. #endif /* ServerTarget */
  373.  
  374.  
  375. #if DoRanlibCmd
  376. #define RanLibrary(args) $(RANLIB) args
  377. #else
  378. #define RanLibrary(args) /**/
  379. #endif
  380.  
  381. /*
  382.  * InstallLibrary - generate rules to install the indicated library.
  383.  */
  384. #ifndef InstallLibrary
  385. #define    InstallLibrary(libname,dest)                    @@@@\
  386. install:: Concat(lib,libname.a)                        @@@@\
  387.     MakeDir($(DESTDIR)dest)                        @@@@\
  388.     $(INSTALL) -c $(INSTLIBFLAGS) Concat(lib,libname.a) $(DESTDIR)dest @@@@\
  389.     RanLibrary($(RANLIBINSTFLAGS) Concat($(DESTDIR)dest/lib,libname.a))
  390. #endif /* InstallLibrary */
  391.  
  392. /*
  393.  * MergeIntoInstalledLibrary - generate rules to merge one library into another
  394.  */
  395. #ifndef MergeIntoInstalledLibrary
  396. #define MergeIntoInstalledLibrary(tolib,fromlib)            @@@@\
  397. install::  fromlib                            @@@@\
  398.     $(SCRIPTSRC)/mergelib $(DESTDIR)tolib fromlib
  399. #endif /* MergeIntoInstalledLibrary */
  400.  
  401. /*
  402.  * InstallLibraryAlias - generate rules to create a link from one library name
  403.  * to another for the purposes of aliasing.
  404.  */
  405. #ifndef InstallLibraryAlias
  406. #define    InstallLibraryAlias(libname,alias,dest)                @@@@\
  407. install::                                @@@@\
  408.     -(cd $(DESTDIR)dest; \                        @@@@\
  409.         $(RM) Concat(lib,alias.a); \                @@@@\
  410.         $(LN) Concat(lib,libname.a) Concat(lib,alias.a))
  411. #endif /* InstallLibraryAlias */
  412.  
  413.  
  414. /*
  415.  * InstallLintLibrary - generate rules to install the indicated lint library.
  416.  */
  417. #ifndef InstallLintLibrary
  418. #define    InstallLintLibrary(libname,dest)                @@@@\
  419. install.ln:: Concat(llib-l,libname.ln)                    @@@@\
  420.     MakeDir($(DESTDIR)dest)                        @@@@\
  421.     $(INSTALL) -c $(INSTLIBFLAGS) Concat(llib-l,libname.ln) $(DESTDIR)dest
  422. #endif /* InstallLintLibrary */
  423.  
  424.  
  425. /*
  426.  * InstallManPageLong - generate rules to install the indicated manual page,
  427.  * giving it an alternate name.  This is used for installing man pages whose
  428.  * base name without the .man suffix would normally be longer than 8 characters
  429.  * (the limit for using source code control systems on files systems with 
  430.  * short file names).
  431.  */
  432. #ifndef InstallManPageLong
  433. #define    InstallManPageLong(file,destdir,dest)                @@@@\
  434. install.man:: file.man                            @@@@\
  435.     MakeDir($(DESTDIR)destdir)                    @@@@\
  436.     $(INSTALL) -c $(INSTMANFLAGS) file.man $(DESTDIR)destdir/dest.$(MANSUFFIX)
  437. #endif /* InstallManPageLong */
  438.  
  439.  
  440. /*
  441.  * InstallManPage - generate rules to install the indicated manual page.
  442.  */
  443. #ifndef InstallManPage
  444. #define    InstallManPage(file,destdir)                    @@@@\
  445. InstallManPageLong(file,destdir,file)
  446. #endif /* InstallManPage */
  447.  
  448.  
  449. /*
  450.  * InstallManPageAliases - generate rules to install manual page aliases.
  451.  */
  452. #ifndef InstallManPageAliases
  453. #define    InstallManPageAliases(file,destdir,aliases)            @@@@\
  454. install.man::                                @@@@\
  455.     @@(TMP=/tmp/tmp.$$$$; \                        @@@@\
  456.     $(RM) $${TMP}; \                        @@@@\
  457.     echo .so `basename destdir`/file.$(MANSUFFIX) > $${TMP}; \    @@@@\
  458.     for i in aliases; do (set -x; \                    @@@@\
  459.     $(INSTALL) -c $(INSTMANFLAGS) $${TMP} $(DESTDIR)destdir/$$i.$(MANSUFFIX)); \ @@@@\
  460.     done; \                                @@@@\
  461.     $(RM) $${TMP})
  462. #endif /* InstallManPageAliases */
  463.  
  464.  
  465. /*
  466.  * InstallNamedNonExec - generate rules to install a data file
  467.  */
  468. #ifndef InstallNamedNonExec
  469. #define    InstallNamedNonExec(srcname,dstname,dest)            @@@@\
  470. install:: srcname                            @@@@\
  471.     MakeDir($(DESTDIR)dest)                        @@@@\
  472.     $(INSTALL) -c $(INSTDATFLAGS) srcname $(DESTDIR)dest/dstname
  473. #endif /* InstallNamedNonExec */
  474.  
  475.  
  476. /*
  477.  * InstallNonExecFile - generate rules to install a data file
  478.  */
  479. #ifndef InstallNonExecFile
  480. #define    InstallNonExecFile(file,dest)                    @@@@\
  481. install:: file                                @@@@\
  482.     MakeDir($(DESTDIR)dest)                        @@@@\
  483.     $(INSTALL) -c $(INSTDATFLAGS) file $(DESTDIR)dest
  484. #endif /* InstallNonExecFile */
  485.  
  486.  
  487. /*
  488.  * InstallNonExec - generate rules to install a data file, but does not
  489.  * try to create the destination directory (deprecated)
  490.  */
  491. #ifndef InstallNonExec
  492. #define    InstallNonExec(file,dest)                    @@@@\
  493. install:: file                                @@@@\
  494.     $(INSTALL) -c $(INSTDATFLAGS) file $(DESTDIR)dest
  495. #endif /* InstallNonExec */
  496.  
  497.  
  498. /*
  499.  * InstallProgramWithFlags - generate rules to install an executable program
  500.  * using given install flags.
  501.  */
  502. #ifndef InstallProgramWithFlags
  503. #define InstallProgramWithFlags(program,dest,flags)            @@@@\
  504. install:: program                            @@@@\
  505.     MakeDir($(DESTDIR)dest)                        @@@@\
  506.     $(INSTALL) -c $(INSTPGMFLAGS) flags program $(DESTDIR)dest
  507. #endif /* InstallProgramWithFlags */
  508.  
  509.  
  510. /*
  511.  * InstallProgram - generate rules to install an executable program using any
  512.  * special install flags set in $(INSTALLFLAGS).
  513.  */
  514. #ifndef InstallProgram
  515. #define    InstallProgram(program,dest)                    @@@@\
  516. InstallProgramWithFlags(program,dest,NullParameter)
  517. #endif /* InstallProgram */
  518.  
  519.  
  520.  
  521. /*
  522.  * InstallScript - install a shell script.
  523.  */
  524. #ifndef InstallScript
  525. #define    InstallScript(program,dest)                    @@@@\
  526. install:: program.script                        @@@@\
  527.     MakeDir($(DESTDIR)dest)                        @@@@\
  528.     $(INSTALL) -c $(INSTBINFLAGS) program.script $(DESTDIR)dest/program
  529. #endif /* InstallScript */
  530.  
  531.  
  532. /*
  533.  * InstallNamedProg - install a program with renaming and no stripping.
  534.  */
  535. #ifndef InstallNamedProg
  536. #define    InstallNamedProg(srcname,dstname,dest)                @@@@\
  537. install:: srcname                            @@@@\
  538.     MakeDir($(DESTDIR)dest)                        @@@@\
  539.     $(INSTALL) -c $(INSTBINFLAGS) srcname $(DESTDIR)dest/dstname
  540. #endif /* InstallNamedProg */
  541.  
  542.  
  543. /*
  544.  * LinkFileList - link a list of list of files from one place to another
  545.  */
  546. #ifndef LinkFileList
  547. #define LinkFileList(step,list,dir,sub)                    @@@@\
  548. step:: list                                @@@@\
  549.     @@case '${MFLAGS}' in *[i]*) set +e;; esac; \            @@@@\
  550.     echo "    cd" dir; cd dir; \                    @@@@\
  551.     for i in list; do (set -x; $(RM) $$i; $(LN) sub/$$i .); done
  552. #endif
  553.  
  554.  
  555. /*
  556.  * InstallMultipleDestFlags - generate rules to install multiple files at
  557.  * once during a particular step in the build using a specific set of install 
  558.  * flags.
  559.  */
  560. #ifndef InstallMultipleDestFlags
  561. #define InstallMultipleDestFlags(step,list,dest,flags)            @@@@\
  562. step:: list                                @@@@\
  563.     MakeDir($(DESTDIR)dest)                        @@@@\
  564.     @@case '${MFLAGS}' in *[i]*) set +e;; esac; \            @@@@\
  565.     for i in list; do \                        @@@@\
  566.         (set -x; $(INSTALL) -c flags $$i $(DESTDIR)dest); \    @@@@\
  567.     done
  568. #endif /* InstallMultipleDestFlags */
  569.  
  570.  
  571. /*
  572.  * InstallMultipleDest - generate rules to install multiple files at once
  573.  * during a particular step in the build using any install flags set in 
  574.  * $(INSTALLFLAGS).
  575.  */
  576. #ifndef InstallMultipleDest
  577. #define InstallMultipleDest(step,list,dest)                @@@@\
  578. InstallMultipleDestFlags(step,list,dest,$(INSTALLFLAGS))
  579. #endif /* InstallMultipleDest */
  580.  
  581. /*
  582.  * InstallMultiple - generate rules to install multiple files at once 
  583.  * during the install step of the build using any install flags set in 
  584.  * $(INSTALLFLAGS).
  585.  */
  586. #ifndef InstallMultiple
  587. #define    InstallMultiple(list,dest)                    @@@@\
  588. InstallMultipleDest(install,list,dest)
  589. #endif /* InstallMultiple */
  590.  
  591.  
  592. /*
  593.  * InstallMultipleFlags - generate rules to install multiple files at once
  594.  * during the install step of the build using the given install flags.
  595.  */
  596. #ifndef InstallMultipleFlags
  597. #define InstallMultipleFlags(list,dest,flags)                @@@@\
  598. InstallMultipleDestFlags(install,list,dest,flags)
  599. #endif /* InstallMultipleFlags */
  600.  
  601.  
  602. /*
  603.  * InstallMultipleMan - generate rules to install a variety of manual pages
  604.  * during the install.man step of the build.
  605.  */
  606. #ifndef InstallMultipleMan
  607. #define InstallMultipleMan(list,dest)                    @@@@\
  608. InstallMultipleDestFlags(install.man,list,dest,$(INSTMANFLAGS))
  609. #endif /* InstallMultipleMan */
  610.  
  611.  
  612. /*
  613.  * InstallAppDefaults - generate rules to install appliation default files 
  614.  * if the InstallAppDefFiles configuration parameter is set.
  615.  */
  616. #ifndef InstallAppDefaults
  617. #if InstallAppDefFiles
  618. #define    InstallAppDefaults(class)                    @@@@\
  619. install:: class.ad                            @@@@\
  620.     MakeDir($(DESTDIR)$(XAPPLOADDIR))                @@@@\
  621.     $(INSTALL) -c $(INSTAPPFLAGS) class.ad $(DESTDIR)$(XAPPLOADDIR)/class
  622. #else
  623. #define    InstallAppDefaults(class)
  624. #endif /* InstallAppDefFiles */
  625. #endif /* InstallAppDefaults */
  626.  
  627. /*
  628.  * InstallAppDefaultsLong - generate rules to install appliation default files 
  629.  * if the InstallAppDefFiles configuration parameter is set.
  630.  */
  631. #ifndef InstallAppDefaultsLong
  632. #if InstallAppDefFiles
  633. #define    InstallAppDefaultsLong(file,class)                @@@@\
  634. install:: file.ad                            @@@@\
  635.     MakeDir($(DESTDIR)$(XAPPLOADDIR))                @@@@\
  636.     $(INSTALL) -c $(INSTAPPFLAGS) file.ad $(DESTDIR)$(XAPPLOADDIR)/class
  637. #else
  638. #define    InstallAppDefaultsLong(file,class)
  639. #endif /* InstallAppDefFiles */
  640. #endif /* InstallAppDefaultsLong */
  641.  
  642.  
  643.  
  644.  
  645. /*
  646.  * DependDependency - generate rules to build the makedepend program if 
  647.  * this Imakefile is within the source tree.
  648.  */
  649. #ifndef DependDependency
  650. #ifdef UseInstalled
  651. #define DependDependency() /**/
  652. #else
  653. #define DependDependency()                         @@@@\
  654. depend:: $(DEPEND)                            @@@@\
  655.                                     @@@@\
  656. $(DEPEND):                                @@@@\
  657.     @@echo "checking $@@ over in $(DEPENDSRC) first..."; \        @@@@\
  658.     cd $(DEPENDSRC); $(MAKE); \                    @@@@\
  659.     echo "okay, continuing in $(CURRENT_DIR)"
  660.  
  661. #endif /* UseInstalled */
  662. #endif /* DependDependency */
  663.  
  664.  
  665. /*
  666.  * DependTarget - generate rules to compute dependencies for all files listed
  667.  * in $(SRCS).
  668.  */
  669. #ifndef DependTarget
  670. #define    DependTarget()                            @@@@\
  671. DependDependency()                            @@@@\
  672.                                     @@@@\
  673. depend::                                @@@@\
  674.     $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
  675. #endif /* DependTarget */
  676.  
  677.  
  678. /*
  679.  * DependTarget3 - generate rules to compute dependencies for all files given.
  680.  */
  681. #ifndef DependTarget3
  682. #define    DependTarget3(srcs1,srcs2,srcs3)                @@@@\
  683. DependDependency()                            @@@@\
  684.                                     @@@@\
  685. depend::                                @@@@\
  686.     $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- srcs1    @@@@\
  687.     $(DEPEND) -a $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- srcs2    @@@@\
  688.     $(DEPEND) -a $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- srcs3
  689. #endif /* DependTarget3 */
  690.  
  691.  
  692. /*
  693.  * CleanTarget - generate rules to remove any garbage files; the #* is here
  694.  * instead of in the definition of RM_CMD because System V will treat the 
  695.  * pound sign in the RM_CMD variable as a comment.
  696.  */
  697. #ifndef CleanTarget
  698. #define    CleanTarget()                            @@@@\
  699. clean::                                    @@@@\
  700.     $(RM_CMD) "#"*
  701. #endif /* CleanTarget */
  702.  
  703.  
  704. /*
  705.  * TagsTarget - generate rules to compute tags files for C source code.
  706.  */
  707. #ifndef TagsTarget
  708. #define    TagsTarget()                            @@@@\
  709. tags::                                    @@@@\
  710.     $(TAGS) -w *.[ch]                        @@@@\
  711.     $(TAGS) -xw *.[ch] > TAGS
  712. #endif /* TagsTarget */
  713.  
  714.  
  715. /*
  716.  * ImakeDependency - generate rules to compile imake if this Imakefile is
  717.  * within the source tree.
  718.  */
  719. #ifndef ImakeDependency
  720. #ifdef UseInstalled
  721. #define ImakeDependency(target) /**/
  722. #else
  723. #define ImakeDependency(target)                        @@@@\
  724. target:: $(IMAKE)                            @@@@\
  725.                                     @@@@\
  726. $(IMAKE):                                @@@@\
  727.     @@(cd $(IMAKESRC); if [ -f Makefile ]; then \            @@@@\
  728.     echo "checking $@@ in $(IMAKESRC) first..."; $(MAKE) all; else \    @@@@\
  729.     echo "bootstrapping $@@ from Makefile.ini in $(IMAKESRC) first..."; \    @@@@\
  730.     $(MAKE) -f Makefile.ini BOOTSTRAPCFLAGS="$(BOOTSTRAPCFLAGS)"; fi; \    @@@@\
  731.     echo "okay, continuing in $(CURRENT_DIR)")
  732. #endif /* UseInstalled */
  733. #endif /* ImakeDependency */
  734.  
  735.  
  736. /*
  737.  * BuildMakefileTarget - generate rules to build a Makefile from an Imakefile
  738.  * and any special imake flags.  This is generally done automatically by the
  739.  * template or by any special Imakefiles.  The first argument exists just
  740.  * because imakeflags is usually empty and some preprocessors will complain
  741.  * if an empty argument is passed as the sole argument to a macro.
  742.  */
  743. #ifndef BuildMakefileTarget
  744. #define    BuildMakefileTarget(notused,imakeflags)                @@@@\
  745. ImakeDependency(Makefile)                        @@@@\
  746.                                     @@@@\
  747. Makefile::                                 @@@@\
  748.     -@@if [ -f Makefile ]; then set -x; \                @@@@\
  749.         $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \    @@@@\
  750.     else exit 0; fi                            @@@@\
  751.     $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) imakeflags
  752.  
  753. #endif /* BuildMakefileTarget */
  754.  
  755.  
  756. /*
  757.  * MakefileTarget - generate rules to build a normal Makefile.
  758.  */
  759. #ifndef MakefileTarget
  760. #define MakefileTarget()                        @@@@\
  761. BuildMakefileTarget(Imakefile,NullParameter)
  762. #endif /* MakefileTarget */
  763.  
  764.  
  765. /*
  766.  * LibMkdir - helper for creating library object subdirectories
  767.  */
  768. #ifndef LibMkdir
  769. #define LibMkdir(dir) DirFailPrefix@@if [ -d dir ]; then exit 0; else set -x; mkdir dir; fi
  770. #endif
  771.  
  772. /*
  773.  * LibCleanDir - helper for cleaning library object subdirectories
  774.  */
  775. #ifndef LibCleanDir
  776. #define LibCleanDir(dir) -@@if [ -d dir ]; then \            @@@@\
  777.         (set -x; cd dir; $(RM) *.o); else exit 0; fi
  778. #endif
  779.  
  780. /*
  781.  * ObjectCompile - compile fragment for a normal object file
  782.  */
  783. #ifndef ObjectCompile
  784. #define ObjectCompile(options) $(RM) $@@                    @@@@\
  785.     $(CC) -c $(CFLAGS) options $*.c
  786. #endif
  787.  
  788. /*
  789.  * NormalLibObjCompile - compile fragment for a normal library object file
  790.  */
  791. #ifndef NormalLibObjCompile
  792. #define NormalLibObjCompile(options) ObjectCompile(options)
  793. #endif
  794.  
  795. /*
  796.  * NormalSharedLibObjCompile - compile fragment for shared object when
  797.  * a normal library is not being built
  798.  */
  799. #ifndef NormalSharedLibObjCompile
  800. #define NormalSharedLibObjCompile(options) NormalLibObjCompile(options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS))
  801. #endif
  802.  
  803. /*
  804.  * LibObjCompile - compile fragment for shared/profiled/debugged objects
  805.  */
  806. #ifndef LibObjCompile
  807. #define LibObjCompile(dir,options) $(RM) $@@ dir/$@@            @@@@\
  808.     $(CC) -c $(CCOPTIONS) $(ALLDEFINES) options $*.c        @@@@\
  809.     $(MV) $@@ dir/$@@
  810. #endif
  811.  
  812. /*
  813.  * DebuggedLibObjCompile - compile fragment for debugged objects
  814.  */
  815. #ifndef DebuggedLibObjCompile
  816. #define DebuggedLibObjCompile(options) LibObjCompile(debugger,-g options)
  817. #endif
  818.  
  819. /*
  820.  * ProfiledLibObjCompile - compile fragment for profiled objects
  821.  */
  822. #ifndef ProfiledLibObjCompile
  823. #define ProfiledLibObjCompile(options) LibObjCompile(profiled,-pg options)
  824. #endif
  825.  
  826. /*
  827.  * SharedLibObjCompile - compile fragment for shared objects
  828.  */
  829. #ifndef SharedLibObjCompile
  830. #define SharedLibObjCompile(options) LibObjCompile(shared,options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS) $(CDEBUGFLAGS))
  831. #endif
  832.  
  833. /*
  834.  * NormalLibraryObjectRule - for simple libraries
  835.  */
  836. #ifndef NormalLibraryObjectRule
  837. #define    NormalLibraryObjectRule()                    @@@@\
  838. .c.o:                                    @@@@\
  839.     ObjectCompile($(_NOOP_))
  840. #endif /* NormalLibraryObjectRule */
  841.  
  842.  
  843. #ifndef NormalFortranObjectRule
  844. #define NormalFortranObjectRule()                    @@@@\
  845. .f.o:                                    @@@@\
  846.     $(RM) $@@                            @@@@\
  847.     $(FC) -c $(FCFLAGS) $*.f
  848. #endif
  849.  
  850. #ifndef ObjectFromSpecialSource
  851. #define ObjectFromSpecialSource(dst,src,flags)                @@@@\
  852. dst.c:  src.c                                @@@@\
  853.     $(RM) $@@                            @@@@\
  854.     $(LN) $? $@@                            @@@@\
  855.                                     @@@@\
  856. dst.o:  dst.c                                @@@@\
  857.     ObjectCompile(flags)                        @@@@\
  858.                                     @@@@\
  859. depend::  dst.c                                @@@@\
  860.                                     @@@@\
  861. clean::                                    @@@@\
  862.     $(RM) dst.c
  863. #endif /* ObjectFromSpecialSource */
  864.  
  865. /*
  866.  * SpecialObjectRule - generate rules to compile a file with special flags.
  867.  */
  868. #ifndef SpecialObjectRule
  869. #define SpecialObjectRule(objs,depends,options)                @@@@\
  870. objs:    depends                                @@@@\
  871.     ObjectCompile(options)
  872. #endif /* SpecialObjectRule */
  873.  
  874.  
  875. /*
  876.  * NormalLibraryTarget - generate rules to create a library.
  877.  */
  878. #ifndef NormalLibraryTarget
  879. #define    NormalLibraryTarget(libname,objlist)                @@@@\
  880. AllTarget(Concat(lib,libname.a))                    @@@@\
  881.                                     @@@@\
  882. Concat(lib,libname.a): objlist                        @@@@\
  883.     $(RM) $@@                            @@@@\
  884.     $(AR) $@@ objlist                        @@@@\
  885.     RanLibrary($@@)
  886. #endif /* NormalLibraryTarget */
  887.  
  888.  
  889. /*
  890.  * NormalLibraryTarget2 - generate rules to create a library in two steps.
  891.  * This is used to create libraries with large numbers of files.
  892.  */
  893. #ifndef NormalLibraryTarget2
  894. #define    NormalLibraryTarget2(libname,objlist1,objlist2)            @@@@\
  895. AllTarget(Concat(lib,libname.a))                    @@@@\
  896.                                     @@@@\
  897. Concat(lib,libname.a): objlist1 objlist2                @@@@\
  898.     $(RM) $@@                            @@@@\
  899.     $(AR) $@@ objlist1                        @@@@\
  900.     $(AR) $@@ objlist2                        @@@@\
  901.     RanLibrary($@@)
  902. #endif /* NormalLibraryTarget2 */
  903.  
  904.  
  905. /*
  906.  * NormalLibraryTarget3 - generate rules to create a library in three steps.
  907.  * This is used to create libraries with very large numbers of files.
  908.  */
  909. #ifndef NormalLibraryTarget3
  910. #define    NormalLibraryTarget3(libname,objlist1,objlist2,objlist3)    @@@@\
  911. AllTarget(Concat(lib,libname.a))                    @@@@\
  912.                                     @@@@\
  913. Concat(lib,libname.a): objlist1 objlist2 objlist3            @@@@\
  914.     $(RM) $@@                            @@@@\
  915.     $(AR) $@@ objlist1                        @@@@\
  916.     $(AR) $@@ objlist2                        @@@@\
  917.     $(AR) $@@ objlist3                        @@@@\
  918.     RanLibrary($@@)
  919. #endif /* NormalLibraryTarget3 */
  920.  
  921.  
  922. /*
  923.  * NormalDepLibraryTarget - generate rules to create a library.
  924.  */
  925. #ifndef NormalDepLibraryTarget
  926. #define    NormalDepLibraryTarget(libname,deplist,objlist)            @@@@\
  927. AllTarget(Concat(lib,libname.a))                    @@@@\
  928.                                     @@@@\
  929. Concat(lib,libname.a): deplist                        @@@@\
  930.     $(RM) $@@                            @@@@\
  931.     $(AR) $@@ objlist                        @@@@\
  932.     RanLibrary($@@)
  933. #endif /* NormalDepLibraryTarget */
  934.  
  935.  
  936. /*
  937.  * SubdirLibraryRule -
  938.  */
  939. #ifndef SubdirLibraryRule
  940. #define    SubdirLibraryRule(objlist)                    @@@@\
  941. all:: DONE                                @@@@\
  942.                                     @@@@\
  943. DONE: objlist                                @@@@\
  944.     touch $@@                            @@@@\
  945.                                     @@@@\
  946. clean::                                    @@@@\
  947.     $(RM) DONE
  948. #endif /* SubdirLibraryRule */
  949.  
  950.  
  951. /*
  952.  * ProfiledLibraryTarget - generate rules to create a profiled library.
  953.  */
  954. #ifndef ProfiledLibraryTarget
  955. #define    ProfiledLibraryTarget(libname,objlist)                @@@@\
  956. AllTarget(Concat3(lib,libname,_p.a))                    @@@@\
  957.                                     @@@@\
  958. Concat3(lib,libname,_p.a): objlist                    @@@@\
  959.     $(RM) $@@                            @@@@\
  960.     cd profiled; $(AR) ../$@@ objlist                @@@@\
  961.     RanLibrary($@@)
  962.  
  963. #endif /* ProfiledLibraryTarget */
  964.  
  965.  
  966. /*
  967.  * DebuggedLibraryTarget - generate rules to create a debuggable library.
  968.  */
  969. #ifndef DebuggedLibraryTarget
  970. #define    DebuggedLibraryTarget(libname,objlist)                @@@@\
  971. AllTarget(Concat3(lib,libname,_d.a))                    @@@@\
  972.                                     @@@@\
  973. Concat3(lib,libname,_d.a): objlist                    @@@@\
  974.     $(RM) $@@                            @@@@\
  975.     cd debugger; $(AR) ../$@@ objlist                @@@@\
  976.     RanLibrary($@@)
  977.  
  978. #endif /* DebuggedLibraryTarget */
  979.  
  980.  
  981. /*
  982.  * AliasedLibraryTarget - generate rules to link one library to another.
  983.  */
  984. #ifndef AliasedLibraryTarget
  985. #define    AliasedLibraryTarget(libname,alias)                @@@@\
  986. AllTarget(Concat(lib,alias.a))                        @@@@\
  987.                                     @@@@\
  988. Concat(lib,alias.a): Concat(lib,libname.a)                @@@@\
  989.     $(RM) $@@                            @@@@\
  990.     $(LN) Concat(lib,libname.a) $@@
  991. #endif /* AliasedLibraryTarget */
  992.  
  993.  
  994. /*
  995.  * NormalRelocatableTarget - generate rules to produce a relocatable object
  996.  * file instead of a library.  
  997.  */
  998. #ifndef NormalRelocatableTarget
  999. #define    NormalRelocatableTarget(objname,objlist)            @@@@\
  1000. AllTarget(objname.o)                            @@@@\
  1001.                                     @@@@\
  1002. objname.o: objlist                            @@@@\
  1003.     $(RM) $@@                            @@@@\
  1004.     $(LD) $(LDCOMBINEFLAGS) objlist -o $@@
  1005. #endif /* NormalRelocatableTarget */
  1006.  
  1007.  
  1008. /*
  1009.  * ProfiledRelocatableTarget - generate rules to produce a profiled relocatable
  1010.  * object file instead of a library.
  1011.  */
  1012. #ifndef ProfiledRelocatableTarget
  1013. #define    ProfiledRelocatableTarget(objname,objlist)            @@@@\
  1014. AllTarget(Concat(objname,_p.o))                        @@@@\
  1015.                                     @@@@\
  1016. Concat(objname,_p.o): objlist                        @@@@\
  1017.     $(RM) $@@                            @@@@\
  1018.     $(LD) -X -r objlist -o $@@
  1019.  
  1020. #endif /* ProfiledRelocatableTarget */
  1021.  
  1022.  
  1023. /*
  1024.  * DebuggedRelocatableTarget - generate rules to produce a debuggable 
  1025.  * relocatable object file instead of a library.
  1026.  */
  1027. #ifndef DebuggedRelocatableTarget
  1028. #define    DebuggedRelocatableTarget(objname,objlist)            @@@@\
  1029. AllTarget(Concat(objname,_d.o))                        @@@@\
  1030.                                     @@@@\
  1031. Concat(objname,_d.o): objlist                        @@@@\
  1032.     $(RM) $@@                            @@@@\
  1033.     $(LD) -X -r objlist -o $@@
  1034.  
  1035. #endif /* DebuggedRelocatableTarget */
  1036.  
  1037.  
  1038. /*
  1039.  * LintLibraryTarget - generate rules to create a lint library.  Note that the
  1040.  * lint library is always forced to be newer than the library itself.
  1041.  */
  1042. #ifndef LintLibraryTarget
  1043. #define    LintLibraryTarget(libname,srclist)                @@@@\
  1044. lintlib:: Concat(llib-l,libname.ln)                    @@@@\
  1045.                                     @@@@\
  1046. Concat(llib-l,libname.ln): srclist                    @@@@\
  1047.     $(RM) $@@                            @@@@\
  1048.     $(LINT) Concat($(LINTLIBFLAG),libname) $(LINTFLAGS) srclist
  1049. #endif /* LintLibraryTarget */
  1050.  
  1051.  
  1052. /*
  1053.  * NormalLintTarget - generate rules to lint a set of sources.
  1054.  */
  1055. #ifndef NormalLintTarget
  1056. #define NormalLintTarget(srclist)                    @@@@\
  1057. lint:                                    @@@@\
  1058.     $(LINT) $(LINTFLAGS) srclist $(LINTLIBS)            @@@@\
  1059. lint1:                                    @@@@\
  1060.     $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
  1061. #endif /* NormalLintTarget */
  1062.  
  1063.  
  1064. /*
  1065.  * LintTarget - generate rules to lint $(SRCS)
  1066.  */
  1067. #ifndef LintTarget
  1068. #define LintTarget()                            @@@@\
  1069. NormalLintTarget($(SRCS))
  1070. #endif
  1071.  
  1072.  
  1073. /*
  1074.  * LinkSourceFile - snag source file from some other directory
  1075.  */
  1076. #ifndef LinkSourceFile
  1077. #define LinkSourceFile(src,dir)                        @@@@\
  1078. src:  dir/src                                @@@@\
  1079.     $(RM) $@@                            @@@@\
  1080.     $(LN) $? $@@                            @@@@\
  1081.  
  1082. #endif
  1083.  
  1084.  
  1085. /*
  1086.  * LinkFile - link a file
  1087.  */
  1088. #ifndef LinkFile
  1089. #define LinkFile(tofile,fromfile)                    @@@@\
  1090. tofile:: fromfile                            @@@@\
  1091.     $(RM) $@@                            @@@@\
  1092.     $(LN) $? $@@
  1093. #endif
  1094.  
  1095.  
  1096. #ifndef MakeSubincludesForBuild
  1097. #define MakeSubincludesForBuild(step,dir,srclist)            @@@@\
  1098. step::  dir srclist                            @@@@\
  1099.     @@-(list=`echo srclist | sed -e 's/[^ ]*\///g'`; \        @@@@\
  1100.         set -x; cd dir; $(RM) $$list)                @@@@\
  1101.     @@for i in srclist; do \                        @@@@\
  1102.         (set -x; cd dir; $(LN) ../$$i .); \            @@@@\
  1103.     done                                @@@@\
  1104.                                     @@@@\
  1105. dir::                                    @@@@\
  1106.     $(MKDIRHIER) dir                        @@@@\
  1107.                                     @@@@\
  1108. clean::                                    @@@@\
  1109.     @@-(if [ -d dir ]; then \                    @@@@\
  1110.         list=`echo srclist | sed -e 's/[^ ]*\///g'`; \        @@@@\
  1111.         set -x; cd dir; $(RM) $$list; else exit 0; fi)
  1112. #endif
  1113.  
  1114.  
  1115. /*
  1116.  * NamedTargetSubdirs - recursively make a series of steps
  1117.  */
  1118. #ifndef NamedTargetSubdirs
  1119. #define NamedTargetSubdirs(name,dirs,verb,flags,subname)        @@@@\
  1120. name::                                    @@@@\
  1121.     @@case '${MFLAGS}' in *[ik]*) set +e;; esac; \            @@@@\
  1122.     for i in dirs ;\                        @@@@\
  1123.     do \                                @@@@\
  1124.         (cd $$i ; echo verb "in $(CURRENT_DIR)/$$i..."; \    @@@@\
  1125.             $(MAKE) $(MFLAGS) flags subname); \        @@@@\
  1126.     done
  1127. #endif
  1128.  
  1129.  
  1130. /*
  1131.  * NamedMakeSubdirs - generate rules to do makes in the given subdirectories.
  1132.  * If you want CDEBUGFLAGS passed along to subdirectories, provide a line like
  1133.  * the following in the appropriate Imakefile
  1134.  * 
  1135.  *         #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
  1136.  */
  1137. #ifndef NamedMakeSubdirs
  1138. #define NamedMakeSubdirs(name,dirs) \
  1139. NamedTargetSubdirs(name,dirs,"making" name,PassCDebugFlags,all)
  1140. #endif /* NamedMakeSubdirs */
  1141.  
  1142. #ifndef MakeSubdirs
  1143. #define MakeSubdirs(dirs)                        @@@@\
  1144. NamedMakeSubdirs(all,dirs)
  1145. #endif /* MakeSubdirs */
  1146.  
  1147.  
  1148. /*
  1149.  * DependSubdirs - generate rules to recursively compute dependencies as
  1150.  * part of the make depend step.
  1151.  */
  1152. #ifndef DependSubdirs
  1153. #define DependSubdirs(dirs) \
  1154. NamedTargetSubdirs(depend,dirs,"depending",NullParameter,depend)
  1155. #endif /* DependSubdirs */
  1156.  
  1157.  
  1158. /*
  1159.  * ForceSubdirs - force make to build subdirectories
  1160.  */
  1161. #ifndef ForceSubdirs
  1162. #define ForceSubdirs(dirs)                        @@@@\
  1163. dirs: FRC                                @@@@\
  1164.     @@cd $@@ ; echo "making all in $(CURRENT_DIR)/$@@..."; \        @@@@\
  1165.     $(MAKE) $(MFLAGS) PassCDebugFlags all                @@@@\
  1166.                                     @@@@\
  1167. FRC:
  1168. #endif /* ForceSubdirs */
  1169.  
  1170. /*
  1171.  * InstallSubdirs - generate rules to recursively install programs and files.
  1172.  */
  1173. #ifndef InstallSubdirs
  1174. #define InstallSubdirs(dirs) \
  1175. NamedTargetSubdirs(install,dirs,"installing",DESTDIR='$(DESTDIR)',install)
  1176. #endif /* InstallSubdirs */
  1177.  
  1178.  
  1179. /*
  1180.  * InstallManSubdirs - generate rules to recursively install manual pages.
  1181.  */
  1182. #ifndef InstallManSubdirs
  1183. #define InstallManSubdirs(dirs) \
  1184. NamedTargetSubdirs(install.man,dirs,"installing man pages",DESTDIR='$(DESTDIR)',install.man)
  1185. #endif /* InstallManSubdirs */
  1186.  
  1187.  
  1188. /*
  1189.  * IncludesSubdirs - generate rules to recursively put include files in build
  1190.  */
  1191. #ifndef IncludesSubdirs
  1192. #define IncludesSubdirs(dirs) \
  1193. NamedTargetSubdirs(includes,dirs,including,NullParameter,includes)
  1194. #endif
  1195.  
  1196.  
  1197. /*
  1198.  * CleanSubdirs - generate rules to recursively clean out garbage files.
  1199.  */
  1200. #ifndef NamedCleanSubdirs
  1201. #define NamedCleanSubdirs(name,dirs) \
  1202. NamedTargetSubdirs(name,dirs,"cleaning",RM_CMD='$(RM_CMD)',clean)
  1203. #endif /* NamedCleanSubdirs */
  1204.  
  1205. #ifndef CleanSubdirs
  1206. #define CleanSubdirs(dirs) \
  1207. NamedCleanSubdirs(clean,dirs)
  1208. #endif
  1209.  
  1210.  
  1211. /*
  1212.  * TagSubdirs - generate rules to recursively create tags files.
  1213.  */
  1214. #ifndef NamedTagSubdirs
  1215. #define NamedTagSubdirs(name,dirs) \
  1216. NamedTargetSubdirs(name,dirs,"tagging",TAGS='$(TAGS)',tags)
  1217. #endif /* TagSubdirs */
  1218.  
  1219. #ifndef TagSubdirs
  1220. #define TagSubdirs(dirs) \
  1221. NamedTagSubdirs(tags,dirs)
  1222. #endif
  1223.  
  1224. /*
  1225.  * MakeLintSubdirs - generate rules to recursively lint directories as part 
  1226.  * of the named step.
  1227.  */
  1228. #ifndef MakeLintSubdirs
  1229. #define MakeLintSubdirs(dirs,target,subtarget) \
  1230. NamedTargetSubdirs(target,dirs,"linting" for target and subtarget,DESTDIR='$(DESTDIR)' LINTOPTS='$(LINTOPTS)',subtarget)
  1231. #endif /* MakeLintSubdirs */
  1232.  
  1233.  
  1234. /*
  1235.  * LintSubdirs - generate rules to recursively lint directories as part of 
  1236.  * the make lint step.
  1237.  */
  1238. #ifndef LintSubdirs
  1239. #define LintSubdirs(dirs)                        @@@@\
  1240. MakeLintSubdirs(dirs,lint,lint)
  1241. #endif /* LintSubdirs */
  1242.  
  1243.  
  1244. /*
  1245.  * MakeLintLibSubdirs - generate rules to recursively create lint libraries.
  1246.  */
  1247. #ifndef MakeLintLibSubdirs
  1248. #define MakeLintLibSubdirs(dirs)                    @@@@\
  1249. MakeLintSubdirs(dirs,lintlib,lintlib)
  1250. #endif /* MakeLintLibSubdirs */
  1251.  
  1252.  
  1253. /*
  1254.  * MakeMakeSubdirs - generate rules to recursively recreate Makefiles as part
  1255.  * of the specified step in the build.  If $(TOP) is set to an absolute path, 
  1256.  * do not prepend the ../ prefix.  This makes running things outside of the 
  1257.  * source tree to be much easier.
  1258.  */
  1259. #ifndef MakeMakeSubdirs
  1260. #define MakeMakeSubdirs(dirs,target)                    @@@@\
  1261. target::                                @@@@\
  1262.     @@case '${MFLAGS}' in *[ik]*) set +e;; esac; \            @@@@\
  1263.     for i in dirs ;\                        @@@@\
  1264.     do \                                @@@@\
  1265.         echo "making Makefiles in $(CURRENT_DIR)/$$i..."; \    @@@@\
  1266.         case "$$i" in \                        @@@@\
  1267.         ./?*/?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \    @@@@\
  1268.         ./?*/?*/?*) newtop=../../../ sub=subsubsub;; \        @@@@\
  1269.         ./?*/?*)    newtop=../../ sub=subsub;; \        @@@@\
  1270.         ./?*)       newtop=../ sub=sub;; \            @@@@\
  1271.         */?*/?*/?*)    newtop=../../../../ sub=subsubsubsub;; \    @@@@\
  1272.         */?*/?*)    newtop=../../../ sub=subsubsub;; \        @@@@\
  1273.         */?*)       newtop=../../ sub=subsub;; \        @@@@\
  1274.         *)        newtop=../ sub=sub;; \            @@@@\
  1275.         esac; \                            @@@@\
  1276.         case "$(TOP)" in \                    @@@@\
  1277.         /?*) newtop=  upprefix=  ;; \                @@@@\
  1278.         *) upprefix=../ ;; \                    @@@@\
  1279.         esac; \                            @@@@\
  1280.         $(MAKE) $${sub}dirMakefiles UPPREFIX=$$upprefix NEWTOP=$$newtop \        @@@@\
  1281.         MAKEFILE_SUBDIR=$$i NEW_CURRENT_DIR=$(CURRENT_DIR)/$$i;\ @@@@\
  1282.     done
  1283. #endif /* MakeMakeSubdirs */
  1284.  
  1285.  
  1286. /*
  1287.  * MakeNsubdirMakefiles - generate rules to create sub Makefiles.
  1288.  */
  1289. #ifndef MakeNsubdirMakefiles
  1290. #define MakeNsubdirMakefiles()                        @@@@\
  1291. subdirMakefiles:                            @@@@\
  1292.     $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak                @@@@\
  1293.     -@@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then set -x; \        @@@@\
  1294.     $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@@@\
  1295.     else exit 0; fi                            @@@@\
  1296.     cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \    @@@@\
  1297.     $(MAKE) $(MFLAGS) Makefiles                     @@@@\
  1298.                                     @@@@\
  1299. subsubdirMakefiles:                            @@@@\
  1300.     $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak                @@@@\
  1301.     -@@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then set -x; \        @@@@\
  1302.     $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@@@\
  1303.     else exit 0; fi                            @@@@\
  1304.     cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \    @@@@\
  1305.     $(MAKE) $(MFLAGS) Makefiles                     @@@@\
  1306.                                     @@@@\
  1307. subsubsubdirMakefiles:                            @@@@\
  1308.     $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak                @@@@\
  1309.     -@@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then set -x; \        @@@@\
  1310.     $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@@@\
  1311.     else exit 0; fi @@@@\
  1312.     cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \    @@@@\
  1313.     $(MAKE) $(MFLAGS) Makefiles                     @@@@\
  1314.                                     @@@@\
  1315. subsubsubsubdirMakefiles:                        @@@@\
  1316.     $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak                @@@@\
  1317.     -@@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then set -x; \        @@@@\
  1318.     $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@@@\
  1319.     else exit 0; fi                         @@@@\
  1320.     cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \    @@@@\
  1321.     $(MAKE) $(MFLAGS) Makefiles
  1322. #endif /* MakeNsubdirMakefiles */
  1323.  
  1324.  
  1325. /*
  1326.  * MakefileSubdirs - generate rules to create Makefiles.
  1327.  */
  1328. #ifndef MakefileSubdirs
  1329. #define MakefileSubdirs(dirs)                        @@@@\
  1330. MakeMakeSubdirs(dirs,Makefiles)                        @@@@\
  1331.                                     @@@@\
  1332. MakeNsubdirMakefiles()
  1333. #endif /* MakefileSubdirs */
  1334.  
  1335. /*
  1336.  * Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
  1337.  * to cpp, because that trick does not work on all ANSI C preprocessors.
  1338.  * Also delete line numbers from the cpp output (-P is not portable, I guess).
  1339.  */
  1340. #ifndef CppSedMagic
  1341. #define CppSedMagic sed -e '/^#  *[0-9][0-9]*  *.*$$/d' \
  1342.             -e '/^XCOMM$$/s//#/' \
  1343.             -e '/^XCOMM[^a-zA-Z0-9_]/s/^XCOMM/#/'
  1344. #endif /* CppSedMagic */
  1345.  
  1346. /*
  1347.  * CppScriptTarget - generate rules to create a shell script by running the
  1348.  * input through cpp.  If the ExecableScripts configuration parameter is not
  1349.  * set, then make sure that the first line begins with a colon.
  1350.  */
  1351. #ifndef CppScriptTarget
  1352. #if ExecableScripts        /* can use #! instead of colon */
  1353. #define CppScriptTarget(dst,src,defs,deplist)                @@@@\
  1354. dst::  src deplist                            @@@@\
  1355.     $(RM) $@@                            @@@@\
  1356.     $(CPP) defs <src | CppSedMagic >$@@                @@@@\
  1357.     chmod a+x $@@
  1358. #else
  1359. #define CppScriptTarget(dst,src,defs,deplist)                @@@@\
  1360. dst::  src deplist                            @@@@\
  1361.     $(RM) $@@                            @@@@\
  1362.     echo \: >$@@                            @@@@\
  1363.     sed '1d' src | $(CPP) defs | CppSedMagic >>$@@            @@@@\
  1364.     chmod a+x $@@
  1365. #endif /* ExecableScripts */
  1366. #endif /* CppScriptTarget */
  1367.  
  1368.  
  1369. /*
  1370.  * MakeScriptFromCpp - generate rules to create a script from a file with a
  1371.  * .cpp suffix.
  1372.  */
  1373. #ifndef MakeScriptFromCpp
  1374. #define MakeScriptFromCpp(name,defs)                    @@@@\
  1375. CppScriptTarget(name,name.cpp,defs,NullParameter)
  1376. #endif /* MakeScriptFromCpp */
  1377.  
  1378. #ifndef CppFileTarget
  1379. #define CppFileTarget(dst,src,defs,deplist)                @@@@\
  1380. dst::  src deplist                            @@@@\
  1381.     $(RM) $@@                            @@@@\
  1382.     $(CPP) defs <src | CppSedMagic >$@@
  1383. #endif /* CppFileTarget */
  1384.  
  1385. /*
  1386.  * MakeDirectories - generate rules to create a hierarchy of directories.
  1387.  */
  1388. #ifndef MakeDirectories
  1389. #define MakeDirectories(step,dirs)                    @@@@\
  1390. step::                                    @@@@\
  1391.     @@case '${MFLAGS}' in *[i]*) set +e;; esac;            @@@@\
  1392.     DirFailPrefix@@for i in dirs; do if [ -d $(DESTDIR)$$i ]; then \    @@@@\
  1393.         set +x; else (set -x; $(MKDIRHIER) $(DESTDIR)$$i); fi \    @@@@\
  1394.     done
  1395. #endif /* MakeDirectories */
  1396.  
  1397.  
  1398. /*
  1399.  * MakeFontsDir - generate rules to build fonts.dir database.
  1400.  */
  1401. #ifndef MakeFontsDir
  1402. #define MakeFontsDir(deplist)                        @@@@\
  1403. all:: fonts.dir                                @@@@\
  1404.                                     @@@@\
  1405. fonts.dir:  deplist                            @@@@\
  1406.     $(MKFONTDIR) .                            @@@@\
  1407.                                     @@@@\
  1408. clean::                                    @@@@\
  1409.     $(RM) fonts.dir
  1410. #endif /* MakeFontsDir */
  1411.  
  1412.  
  1413. /*
  1414.  * MakeFonts - generate rules to build font database.
  1415.  */
  1416. #ifndef MakeFonts
  1417. #define MakeFonts()                            @@@@\
  1418. all::  $(OBJS)                                @@@@\
  1419.                                     @@@@\
  1420. MakeFontsDir($(OBJS))                            @@@@\
  1421.                                     @@@@\
  1422. clean::                                    @@@@\
  1423.     $(RM) *.snf *.snf.Z *.pcf *.pcf.Z
  1424. #endif /* MakeFonts */
  1425.  
  1426.  
  1427. /*
  1428.  * InstallFontObjs - generate rules to install font files
  1429.  */
  1430. #ifndef InstallFontObjs
  1431. #define InstallFontObjs(objs,dest)                    @@@@\
  1432. InstallMultipleFlags(objs,dest,$(INSTDATFLAGS))                @@@@\
  1433.                                     @@@@\
  1434. install::  fonts.dir                            @@@@\
  1435.     MakeDir($(DESTDIR)dest)                        @@@@\
  1436.     $(INSTALL) -c $(INSTDATFLAGS) fonts.dir $(DESTDIR)dest
  1437. #endif /* InstallFontObjs */
  1438.  
  1439.  
  1440. /*
  1441.  * InstallFonts - generate rules to install font files
  1442.  */
  1443. #ifndef InstallFonts
  1444. #define InstallFonts(dest)                        @@@@\
  1445. InstallFontObjs($(OBJS),dest)
  1446. #endif /* InstallFonts */
  1447.  
  1448.  
  1449. /*
  1450.  * InstallFontAliases - generate rules to install font aliases databases. 
  1451.  */
  1452. #ifndef InstallFontAliases
  1453. #define InstallFontAliases(dest)                    @@@@\
  1454. install::  fonts.alias                            @@@@\
  1455.     MakeDir($(DESTDIR)dest)                        @@@@\
  1456.     $(INSTALL) -c $(INSTDATFLAGS) fonts.alias $(DESTDIR)dest
  1457. #endif /* InstallFontAliases */
  1458.  
  1459. #ifndef FontSrc
  1460. #define FontSrc(basename) basename.bdf
  1461. #endif
  1462.  
  1463. #ifndef FontBaseObj
  1464. #ifdef SnfFonts
  1465. #define FontBaseObj(basename)basename.snf
  1466. #else
  1467. #define FontBaseObj(basename)basename.pcf
  1468. #endif
  1469. #endif
  1470.  
  1471. /*
  1472.  * InstallFontScale - generate rules to install font scale database.
  1473.  */
  1474. #ifndef InstallFontScale
  1475. #define InstallFontScale(dest)                        @@@@\
  1476. install::  fonts.scale                            @@@@\
  1477.     MakeDir($(DESTDIR)dest)                        @@@@\
  1478.     $(INSTALL) -c $(INSTDATFLAGS) fonts.scale $(DESTDIR)dest
  1479. #endif /* InstallFontScale */
  1480.  
  1481. /*
  1482.  * UncompressedFontTarget
  1483.  */
  1484. #ifndef UncompressedFontTarget
  1485. #ifdef SnfFonts
  1486. #define UncompressedFontTarget(basename)                @@@@\
  1487. FontBaseObj(basename):  FontSrc(basename)                @@@@\
  1488.     $(FONTC) $(FONTCFLAGS) $? >$@@
  1489. #else
  1490. #define UncompressedFontTarget(basename)                @@@@\
  1491. FontBaseObj(basename):  FontSrc(basename)                @@@@\
  1492.     $(FONTC) $(FONTCFLAGS) $? -o $@@
  1493. #endif
  1494. #endif /* CompressedFontTarget */
  1495.  
  1496. /*
  1497.  * CompressedFontTarget
  1498.  */
  1499. #ifndef CompressedFontTarget
  1500. #define CompressedFontTarget(basename)                    @@@@\
  1501. FontBaseObj(basename).Z:  FontSrc(basename)                @@@@\
  1502.     $(FONTC) $(FONTCFLAGS) $? | $(COMPRESS) > $@@
  1503. #endif /* CompressedFontTarget */
  1504.  
  1505. #ifdef CompressAllFonts
  1506. #define FontTarget(basename) CompressedFontTarget(basename)
  1507. #define FontObj(basename) FontBaseObj(basename).Z
  1508. #else
  1509. #define FontTarget(basename) UncompressedFontTarget(basename)
  1510. #define FontObj(basename) FontBaseObj(basename)
  1511. #endif /* CompressAllFonts */
  1512.  
  1513. /*
  1514.  * AllTarget - generate rules to build necessary things during make all.
  1515.  */
  1516. #ifndef AllTarget
  1517. #define AllTarget(depends)                        @@@@\
  1518. all:: depends
  1519. #endif /* AllTarget */
  1520.  
  1521. #ifdef DefineOldLibraryRules
  1522. #include <oldlib.rules>
  1523. #endif
  1524. @
  1525.